package com.gzo.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("test")
public class QueryDbController {

    @Autowired
    JdbcTemplate jdbcTemplate;

    @GetMapping
    public String data(){
        String select_ = jdbcTemplate.queryForObject("SELECT NAME FROM test WHERE id=5 ", String.class);
        return select_;
    }
}
